﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.Entity;
using ClassLibrary.DAO;
using ClassLibrary.Data;

public partial class UserControl_ucLoanPhoneDetails : System.Web.UI.UserControl
{
    TblLoan2PhoneDAO Loan2PhoneDAO = new TblLoan2PhoneDAO(Global.CONNECTION_STRING);
    TblLoanPhoneDAO LoanPhoneDAO = new TblLoanPhoneDAO(Global.CONNECTION_STRING);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadLoanPhoneByJobID();
        }
    }
    private void LoadLoanPhoneByJobID()
    {
        string id = Request.QueryString["id"];
        DataTable LPhoneByJob = LoanPhoneDAO.LoadLoanPhoneByJobID(Convert.ToInt32(id));
        foreach (DataRow dr in LPhoneByJob.Rows)
        {
            txt_idloan.Text = dr["LoanID"].ToString();
            txtLphoneID.Text = dr["LPhoneID"].ToString();
            txt_Brand.Text = dr["Brand"].ToString();
            txt_model.Text = dr["Model"].ToString();
            txt_IME.Text = dr["IMENo"].ToString();
            txt_access.Text = dr["AccessoriesIncluded"].ToString();
            txt_amount.Text = dr["AmountDeposited"].ToString();
            txt_loanfee.Text = dr["LoanFee"].ToString();
            txt_notes.Text = dr["Notes"].ToString();
            txt_datein.Text = dr["DateIn"].ToString();
            txt_dateout.Text = dr["DateOut"].ToString();
            txtPayment.Text= dr["PaymentMethod"].ToString();
            if (Convert.ToBoolean(dr["DepositeTaken"]) == true)
                cbDepositeTaken.Checked = true;
        }
    }
}
